import pytest_check as check
def assert_equal(r,expect,keys):
    '''
    assert r.json()['msg'] == login_data['expect']['msg']
    assert r.json()['code'] == login_data['expect']['code']
    assert r.json()['status'] == login_data['expect']['status']

    Asserts.assert_equal(r,expect,"meg,code,status")
    :return:
    '''

    response = r.json()
    ks = keys.split(",")
    for key in ks :
        ret = response.get(key) # 根据key取value
        exp = expect.get(key) # 根据key取value

        try:
            check.equal(ret,exp) # 校验respone中的value和预期结果的value是否一致
            print(f"检验{key}成功")
        except Exception as e:
            print(f"检验{key}失败")

